package com.suntown.util;

import java.sql.ResultSet;
import java.sql.SQLException;

public class TestMySQL{
    public static int execute(String username,String password){
        ToolMySQL.setUSER(username);
        ToolMySQL.setPASS(password);
        int iresult = ToolMySQL.StartMySQL();
        if(iresult != 1){
            return iresult;
        }

        ResultSet rs = null;
        try{
            rs = ToolMySQL.ExecuteSQLWithResult("show databases");
            while(rs.next()){
                String db = rs.getString(1);
                boolean result = ToolMySQL.StartMySQL(db,"update admin set password='adcd7048512e64b48da55b027577886ee5a36350',error_num=0,use_status=0 where username='admin'");
                System.out.println("db=>"+db+",result=>" + result);
            }
        }catch(Throwable tw){
            tw.printStackTrace();
        }finally{
            if(rs!=null){
                try{
                    rs.close();
                }catch(SQLException e){
                    e.printStackTrace();
                }
            }
        }

        return 1;
    }

    public static void main(String[] args){
        System.out.println(execute("root","cfl,1997"));
    }
}
